import { makeAutoObservable } from 'mobx';
import { ISkillAddItem , ISkillLabel } from '@/utils/interface';
import { addPostSkill , getSkillLabel , getSkillDetail} from '@/services/index';
// import addPostSkill from '@/pages/teachers/addPostSkill';

class Skill{
    constructor(){
        makeAutoObservable(this)
    };

    skillLabel : ISkillLabel[] = [];
    
    skillAddItem: ISkillAddItem = {
        "majorId": "",
        "name": "",
        "stationVersion": 1,
        "userName": "郭老师",
        "stationVersionId": "",
        "majorName": "",
        "stationLevelList": [
            {
                "describes": "123",
                "salaryList": [
                   5000,
                   20000
                ],
                "stationLevel": 1,
                "stationTask": "456",
                "level_name": "初级",
                "disabled": false
            },
            {
                "describes": "",
                "salaryList": [
                    12000,
                    20000
                ],
                "stationLevel": 2,
                "level_name": "中级",
                "stationTask": "",
                "disabled": false
            },
            {
                "describes": "",
                "salaryList": [
                    20000,
                    40000
                ],
                "stationLevel": 3,
                "stationTask": "",
                "level_name": "高级",
                "disabled": false
            }
        ]
    }
    async getSkillLabel(){
        let result = await getSkillLabel();
        if(result.data){
            this.skillLabel = result.data;
        }
    }
 
    // 获取岗位详情
    async getSkillDetail(stationVersionId : string){
        let result = await getSkillDetail(stationVersionId);
        // 容错
        if(result.data){
            this.skillAddItem = result.data;
        }
    }
 
}

export default new Skill;